Class.$("DomBlockDrag",{
	_constructor : function (id) {  //构造函数
		var block = this;
		this.disX = 0;
		this.disY = 0;
		this.o = document.getElementById(id);
		this.o.style.position = "fixed";
		this.o.style.cursor = "pointer";
		this._listenMouseDown(); //开始监听鼠标事件  
	},

	_listenMouseDown : function(){
		var block = this;
		this.o.onmousedown = function(ev) { 
			var oEvent = ev || event; 
			block._recordClickPosition(oEvent); //记录鼠标坐标
			block._listenMouseMove(); //监听鼠标移动事件
			block._listenMouseUp(); //监听鼠标释放事件
		}
	},

	_listenMouseUp : function (){
		document.onmouseup = function(){ 
			document.onmousemove = null;
			document.onmouseup = null;
		};
	},

	_listenMouseMove : function (){
		var block = this;  
		document.onmousemove = function(ev){ 
			block._blockMove(ev);
			return false;
		};
	},

	_recordClickPosition : function (ev){ 
		var oEvent = ev || event;
		this.disX = oEvent.clientX - this.o.offsetLeft;
		this.disY = oEvent.clientY - this.o.offsetTop; 
	},

	_blockMove: function (ev) {
		var oEvent = ev || event; 
		this.o.style.left = oEvent.clientX - this.disX + 'px';
		this.o.style.top = oEvent.clientY - this.disY + 'px'; 
	}
});